package ir.sourcecodes.animalsounds;

import java.util.ArrayList;
import java.util.Random;

public class MathHelper {
    public static float computeDiff(float f, float f2, float f3, float f4) {
        return (float) Math.sqrt(Math.pow((double) (f - f3), 2.0d) + Math.pow((double) (f2 - f4), 2.0d));
    }

    public static int getRandom(int i, int i2) {
        double random = Math.random();
        double d = (double) ((i2 - i) + 1);
        Double.isNaN(d);
        return ((int) Math.floor(random * d)) + i;
    }

    public static ArrayList<Integer> generateRandomArray(int i, int i2, int i3) {
        ArrayList<Integer> arrayList = new ArrayList<>();
        arrayList.clear();
        Random random = new Random();
        int i4 = (i2 - i) + 1;
        arrayList.add(0, Integer.valueOf(random.nextInt(i4) + i));
        int i5 = 1;
        while (i5 < i3) {
            arrayList.add(i5, Integer.valueOf(random.nextInt(i4) + i));
            int i6 = 0;
            while (i6 < i5) {
                if (arrayList.get(i5) == arrayList.get(i6)) {
                    arrayList.remove(i5);
                    i5--;
                    i6 = 0;
                }
                i6++;
            }
            i5++;
        }
        return arrayList;
    }
}
